package com.woniuxy.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.employee.Inspector;
import com.woniuxy.service.employee.InspectorService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Resource
    private InspectorService inspectorService;
    @PostMapping("/queryInspector")
    public ResponseData<?> queryInspector(@RequestBody PageData<Inspector> pageData){
        PageInfo<Inspector> inspectorPageInfo = inspectorService.queryInspector(pageData);
        return new ResponseData<>().OK(inspectorPageInfo);
    }
    @PostMapping("/addInspector")
    public ResponseData<?> addInspector(@RequestBody Inspector inspector){
        return inspectorService.addInspector(inspector);
    }
    @PostMapping("/editInspector")
    public ResponseData<?> editInspector(@RequestBody Inspector inspector){
        return inspectorService.editInspector(inspector);
    }
    @GetMapping("/delInspector/{id}")
    public ResponseData<?> delInspector(@PathVariable("id")Integer id){
        return inspectorService.delInspector(id);
    }
}
